﻿var count = 500;
function limiter(id) {
    var tex = document.getElementById(id).value;
    // alert(tex);
    var len = tex.length;
    if (len > count) {
        tex = tex.substring(0, count);
        document.getElementById(id).value = tex;
        return false;
    }

}
function ShowHideDiv(id, flag) {
    if (flag == "1")
    {document.getElementById('' + id + '').style.display = "block"; }
    else
    { document.getElementById('' + id + '').style.display = "none"; }
}
function toggleDiv(id, flagit) {
    if (flagit == "1") {
        if (document.layers) document.layers['' + id + ''].visibility = "show"
        else if (document.all) document.all['' + id + ''].style.visibility = "visible"
        else if (document.getElementById) document.getElementById('' + id + '').style.visibility = "visible"
    }
    else
        if (flagit == "0") {
            if (document.layers) document.layers['' + id + ''].visibility = "hide"
            else if (document.all) document.all['' + id + ''].style.visibility = "hidden"
            else if (document.getElementById) document.getElementById('' + id + '').style.visibility = "hidden"
        }
    }
    function trim(stringToTrim) {

        return stringToTrim.replace(/^\s+|\s+$/g, "");

    }

    function ltrim(stringToTrim) {

        return stringToTrim.replace(/^\s+/, "");

    }

    function rtrim(stringToTrim) {

        return stringToTrim.replace(/\s+$/, "");

    }
    function ISNumber(Value) {
        var reg = /^([0-9]{1,5})$/;
        if (reg.test(Value) == false)
        { return false; }
        else {
            return true;
        }
    }
    function ISChar(Value) {
        var reg = /^([a-zA-Z _]{2,100})$/;
        if (reg.test(Value) == false)
        { return false; }
        else {
            return true;
        }
    }
    function validate(Email) {

        var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;


        if (reg.test(Email) == false) {

            return false;
        }
        else {
            return true;
        }
    }
    function MobileValidate(MobileNo) {
        var reg = /^([7-9]{1})([0-9]{9})$/;
        if (reg.test(MobileNo) == false)
        { return false; }
        else {
            return true;
        }
    }
    function LandlineValidate(PhoneNo) {
        var reg = /^([1-9]{1})([0-9]{7})$/;
        if (reg.test(PhoneNo) == false)
        { return false; }
        else {
            return true;
        }
    }